<?php
namespace app\admin\controller;
use think\Controller;
class Login extends Controller
{
	//后台管理员用户登录
	public function index(){
		if(request() -> isPost()){
           $data = model('Login')->index();
            if($data == 1){
                $this->redirect('admin/index/index');
			}elseif($data == 4){
               $this->success('你已经被迫下线','admin/login/index','',1);
	   	   	    exit;
			}elseif($data == 5){
               $this->redirect('admin/login/index');
			}else{
				$this->error('用户名或密码错误');
	   	   	    exit;
			}
		}else{

		}
		return $this->fetch();
	}

	//后台管理用户退出
	public function loginout(){
		// 清除session (当前作用域)
		session(null);
		$this->redirect('admin/login/index');
	}
}